package com.itheima.d1_map_impl;

import java.util.TreeMap;

/**
 * 目标：掌握TreeMap集合的使用。
 */
public class Test3TreeMap {
    public static void main(String[] args) {

        TreeMap<Integer,String> tree = new TreeMap<>();
        tree.put(3,"oo");
        tree.put(9,"oo");
        tree.put(3,"oo");
        tree.put(5,"oo");
        tree.put(1,"oo");
        System.out.println(tree);

        TreeMap<Integer,String> tree1 = new TreeMap<>((s1,s2)->s2-s1);
        tree1.put(3,"oo");
        tree1.put(9,"oo");
        tree1.put(3,"oo");
        tree1.put(5,"oo");
        tree1.put(1,"oo");
        System.out.println(tree1);

    }
}
